class CreateRuns < ActiveRecord::Migration
  def self.up
    create_table :runs, :primary_key => :run_id do |t|
     t.column :problem_id, :integer, :null => false
     t.column :user_id , :integer, :null => false
     t.column :submit_time, :datetime, :null => false 
     t.column :language, :string, :limit => 16, :null => false
     t.column :source_code, :text, :null => false
     t.column :source_name, :string , :limit => 32 , :null => false
     t.column :about, :text, :null => false
     t.column :status, :string, :limit => 16, :null => false
     t.column :log,:text,:null => false
    end
#    execute "alter table runs add constraint fk_runs_problems 
#            foreign key (problem_id) references problems(problem_id)"
#    execute "alter table runs add constraint fk_runs_users
#            foreign key (user_id) references users(user_id)"
  end

  def self.down
    drop_table :runs
  end
end
